<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no" />
    <title>文本摘要</title>
    <!--标准mui.css-->
    <link rel="stylesheet" href="../css/mui.min.css">
    <script src="../js/mui.min.js"></script>
    <!--App自定义的css-->
    <link rel="stylesheet" type="text/css" href="../css/app.css" />
    <script src="../js/flexible.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../js/jquery-3.6.0.min.js"></script>
    <script src="../js/sm2.js"></script>
    <script src="../js/sm3.js"></script>
    <script src="../js/feedback.js"></script>
    <script src="../js/clipboard.js"></script>+
    <script src="../wx/uap.js"></script>
    <script src="../js/vconsole.min.js"></script>
    <script src="./text.js" type="text/javascript"></script>
    <script src="./index1.js"></script>
    <style>
        #app {
            background: #F7FAFF;
            position: relative;
        }

        .mui-btn-blue,
        .mui-btn-primary,
        input[type=submit] {
            background-color: rgb(25, 179, 182);
            color: #fff;
            border: 1px solid rgb(25, 179, 182);
            border-radius: 4px;
            margin-right: 10px;
        }

        .left {
            text-align: center;
        }

        .left a {
            line-height: 0.5rem;
            color: #fff;
        }

        .left .left1 {
            position: absolute;
            left: 0.1rem;
            top: 0.25rem;
        }

        .left :nth-child(1) span {
            line-height: 0.5rem;
            color: #fff;
        }

        .left :nth-child(2) span {
            line-height: 0.5rem;
            color: #fff;
        }

        .file-input {
            opacity: 0;
            height: 100%;
            width: 100%;
            z-index: 1;
            position: absolute;
            left: 0;
            top: 0;
        }

        .top {
            height: 4.5rem;
            width: 100%;
            box-sizing: border-box;
            font-size: 0.3rem;
            /* border: 3px dashed rgb(25, 179, 182); */
            position: relative;
            border-radius: 10px;
            padding: 0.3rem;
            margin-bottom: 0.3rem;
            background-color: #fff;
        }

        .shorthand {
            width: 100%;
            /* margin-bottom: 1.2rem; */
            padding: 0.5rem 0.25rem 0;
        }

        .hr {
            background-color: #E21040;
            width: 2px;
            height: 0.07rem;
            /* float: right; */
            /* margin-left:6px; */
            animation: liner 1s ease-in-out;
            animation-iteration-count: infinite;
            animation-direction: alternate;
        }

        .hrf {
            background-color: #E21040;
            width: 2px;
            height: 0.1rem;
            float: right;
            margin-left: 3px;
        }

        .hr1,
        .hr4,
        .hr7,
        .hr10,
        .hr13,
        .hr16,
        .hr19,
        .hr22,
        .hr25 {
            animation-delay: -2s;
        }

        .hr2,
        .hr5,
        .hr8,
        .hr11,
        .hr14,
        .hr17,
        .hr20,
        .hr23,
        .hr26 {
            animation-delay: -1s;
        }

        .hr3,
        .hr6,
        .hr9,
        .hr12,
        .hr15,
        .hr18,
        .hr21,
        .hr24 {
            animation-delay: -1.5s;
        }

        @keyframes liner {
            0% {
                transform: scaleY(1);
            }

            100% {
                transform: scaleY(6);
            }
        }

        .lines1 {
            display: flex;
            align-items: center;
            background: url("../image/line.png") no-repeat center;
            background-size: 100% 100%;
            width: 80%;
            height: 0.4rem;
            margin: 0.4rem auto;
        }

        .lines {
            width: 70%;
            margin: 0 auto;
        }

        .time {
            width: 12%;
        }

        .startD {
            width: 20%;
            text-align: center;
            /* margin-top: 0.6rem; */
        }

        .start {
            width: 0.4rem
        }

        #clipboardContent {
            background-color: rgb(255, 255, 255);
            padding: 0.25rem;
            /* position: relative; */
            /* height: calc(100vh - 5.1rem); */
            overflow: scroll;
            border: 1px solid #D8E6FE;
            color: #333;
            height: 6.1rem;
            font-size: 0.3rem;
        }

        .form {
            padding: 0.2rem;
            /* background: #fff; */
            margin: 0.2rem 0.2rem 0.2rem;
        }


        .mui-btn-blue,
        .mui-btn-primary,
        input[type=submit] {
            background-color: rgb(25, 179, 182);
            color: #fff;
            border: 1px solid rgb(25, 179, 182);
            border-radius: 4px;
            margin-right: 10px;
        }

        .titleInput {
            outline: 0;
            -web-kit-appearance: none;
            -moz-appearance: none;
            font-size: 0.3rem;
            height: 2.7rem;
            border-radius: 4px;
            border: 1px solid #D8E6FE;
            color: #333;
            width: 100%;
            margin-bottom: 0.2rem;
            -webkit-user-select: auto;
            -moz-user-select: auto;
            padding: 0.1rem 0.2rem;
        }

        /* WebKit browsers */

        ::-webkit-input-placeholder {
            color: #D8E6FE;
        }

        /* Mozilla Firefox 4 to 18 */

        :-moz-placeholder {
            color: #D8E6FE;
            opacity: 1;
        }

        /* Mozilla Firefox 19+ */

        ::-moz-placeholder {
            color: #D8E6FE;
            opacity: 1;
        }

        /* Internet Explorer 10+ */

        :-ms-input-placeholder {
            color: #D8E6FE;
        }

        .mui-toast-container {
            top: 50%
        }

        .uldisplay1 {
            padding-left: 0.3rem;
        }


        .tips {
            font-size: 12px;
            color: #000;
            margin-left: 5%;
        }


        .is-dialog {
            overflow: hidden;
        }

        .is-dialog .dialog {
            filter: progid: DXImageTransform.Microsoft.Alpha(enabled=false);
            /* opacity: 0.7; */
            /* z-index: 1111; */
        }

        .is-dialog .dialog {
            filter: progid: DXImageTransform.Microsoft.Alpha(enabled=false);
        }

        .dialog {
            display: none;
            position: fixed;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            background-color: rgba(0, 0, 0, 0.3);
            -moz-transition: all 1s ease;
            -o-transition: all 1s ease;
            -webkit-transition: all 1s ease;
            transition: all 1s ease;
            filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
            z-index: 99999;
            overflow: hidden;
        }

        .dialogBgc {
            width: 5rem;
            position: relative;
            left: 50%;
            border-radius: 20px;
            top: 50%;
            height: 2.5rem;
            background: #fff;
            z-index: 111;
            transform: translate(-50%, -50%);
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div class="is-loading">
            <div class="is-loading">
                <div class="curtain">
                    <div class="loadingBgc">
                        <div class="loader"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class='trainTickets'>
            <div class='trainTicketstitle'>
                <div class='arrow clearfix'>
                    <div class='left'>
                        <span class='left1' @click='back'>
                            <b class="mui-icon mui-icon-left-nav mui-pull-left"></b>
                            <!-- <span>返回</span> -->
                        </span>
                        <!-- <van-icon name="arrow-left" /> -->
                        <span style='font-weight: 600;'>文本摘要</span>
                    </div>

                </div>
            </div>
        </div>
        <div class='shorthand'>
            <textarea  @input=slText1(content) style="margin-bottom: 0;" placeholder="请输入摘要信息（只能输入中英文，数字，下划线，中文逗号句号，1-500字符）"   v-model='content' class='clipboardContent'
                type='text' id='clipboardContent' maxlength="500"></textarea>
            <button @click="continueBtn" type="button" style="margin-bottom: .2667rem; float: right;" class="mui-btn mui-btn-primary">
                摘要
            </button>
            <textarea  @input=slText(title) maxlength="500"  placeholder=" 注：摘要后的信息显示（只能输入中英文，数字，下划线，中文逗号句号，1-500字符）" v-model='title' class='titleInput'
                id='titleInput'></textarea>
        </div>
    </div>
    </div>
    <script>
        new Vue({
            el: '#app',

            data() {
                // })
                return {
                    flag: true,
                    ticket: '',
                    phoneticToken: '',
                    Base64Binary: null,
                    input: '',
                    content: '',
                    VoiceItem: {},
                    VoiceFlag: false,
                    isFlagStart: true,
                    title: '',
                    isFlagStartTrue: false,
                    isFlagStartTitle: false,
                    checkSwitch: false,
                    time1: 30, // 单次使用时长
                    timetimer1: null, //控制语音30秒定时器
                    scroll: '',
                    allTime: 0,
                }
            },
            created() {
               
            },
            methods: {
                slText(text) {
                  this.title = text.replace(/[^\w\u4E00-\u9FA5\_，。]/g, '')
                },
                slText1(text) {
                  this.content = text.replace(/[^\w\u4E00-\u9FA5\_，。]/g, '')
                },
                back() {
                        // $(".dialog").css("display", "block");
                        if (this.content == '' && this.content.split(" ").join("").length == 0 && this.content == '' && this.content.split(" ").join("").length == 0) {
                            $(location).attr("href", "Home.html?flag=yyyyflag");
                        } else {
                            var btnArray = ["取消", "确定"];
                            var i = 0
                            mui.confirm(
                                "请问是否进行纠错？",
                                "消息提醒",
                                btnArray,
                                (e) => {
                                    if (i > 0) return
                                    i++
                                    if (e.index == 1) {
                                        this.continueBtn()
                                    } else {
                                        $(location).attr("href", "Home.html?flag=yyyyflag");
                                    }
                                }
                            );
                    }
                },
                continueBtn() {
                    if (!this.content && this.content.split(" ").join("").length == 0) {
                        mui.toast('摘要内容不能为空', {
                            duration: 1000,
                            type: 'div'
                        })
                        return
                    }
                    if (this.content == 'null' || this.content == 'Null' || this.content == 'NUll' || this.content == 'undefined' || this.content == "false" || this.content == "true" ) {
                        mui.toast("不能输入关键字", {
                            duration: 'long',
                            type: 'div'
                        })
                        return
                    }
                    $(".dialog").css("display", "block");
                    let AuthenticationSession = sessionStorage.getItem("Authentication");
                    if (sessionStorage.getItem("iscp_port")) {
                        iscp_port = sessionStorage.getItem("iscp_port");
                    } else {
                        iscp_port = ""
                    }
                    userId = sessionStorage.getItem("userId");
                    let data = {
                        message: this.content,
                        timestamp: new Date().getTime() + "", //时间戳
                        userId: userId,
                        num:3,
                    }
                    data = JSON.stringify(data)
                    let sign = sm3(data)
                    $.ajax({
                        url: localUrlLink + iscp_port + "/tjAiAssistant/operator/voiceRelated",
                        type: "post",
                        async: false, //是否同步，false表示同步请求
                        dataType: "json",
                        data: data,
                        headers: {
                            "Content-Type": "application/json;charset=UTF-8",
                            Authentication: AuthenticationSession,
                            sign: sign,
                        },
                        success: (res, txt, xhr) => {
                            $(".dialog").css("display", "none");
                            if (sm3(res.resultValueStr) == xhr.getResponseHeader("sign")) {
                                let Authentication = xhr.getResponseHeader("Authentication")
                                if (res.code == 200) {
                                    if (Authentication) {
                                        sessionStorage.setItem("Authentication", Authentication);
                                        mui.toast(res.resultValue, {
                                            duration: 'long',
                                            type: 'div'
                                        })
                                        this.title = res.resultValue.content
                                    }
                                } else {
                                    mui.toast(res.resultValue, {
                                            duration: 'long',
                                            type: 'div'
                                        })
                                }   
                            } else {
                                mui.toast('完整性校验失败', {
                                            duration: 'long',
                                            type: 'div'
                                        })
                            }
                        },
                        error: function (e) {
                    $(".dialog").css("display", "none");
                            mui.toast("请求异常请稍后再试", {
                                duration: 'long',
                                type: 'div'
                            })
                        },
                    });
                },
            }
        })
    </script>
</body>

</html>